package net.messagenet.mazor.infra.persistence.entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 
 * This entity bean represents a DPA request 
 * Containing all the data need for the excel sheet.
 * 
 * @author Idan
 *
 */


@Entity
@Table(name="MZR_DPA")
@Inheritance
public class Dpa implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)

	private int id;
	private String dpaId;
	private Date requestDate;
	private String contact;
	private String cc;
	private String email;
	private String dialogicfse;
	private String endUserName;
	private String ReasonForRequest;
	private String additionalInformation;
	private Date expirationDate;
	private String fileName;
	
	private boolean draft;
	private boolean approved;
	private boolean closed;
	
	@ManyToOne
	private Customer customer;
	@OneToMany(mappedBy="dpa")
    private List<DpaProduct> dpaProducts;
	
	/**
	 * returns the list of all the products that contained within this dpa
	 * 
	 * @return products list
	 */
	
	public List<DpaProduct> getDpaProducts() {
		return dpaProducts;
	}
	/**
	 * sets the list of all the products that contained within this dpa
	 * 
	 * @param dpaProducts
	 */
	public void setDpaProducts(List<DpaProduct> dpaProducts) {
		this.dpaProducts = dpaProducts;
	}
	/**
	 * returns the DPA id
	 * 
	 * @return id
	 */
	public String getDpaId() {
		return dpaId;
	}
	/**
	 * sets the DPA id
	 * 
	 * @param dpaId
	 */
	public void setDpaId(String dpaId) {
		this.dpaId = dpaId;
	}

	/**
	 * returns the contact
	 * 
	 * @return contact name
	 */
	public String getContact() {
		return contact;
	}
	/**
	 * sets the contact
	 * 
	 * @param contact
	 */
	public void setContact(String contact) {
		this.contact = contact;
	}
	/**
	 * gets the email of the sender
	 * 
	 * @return  email of the sender
	 */
	public String getEmail() {
		return email;
	}
	/**
	 * Sets the email of the sender 
	 * 
	 * @param email
	 */
	public void setEmail(String email) {
		this.email = email;
	}
	/**
	 * Sets the cc for the  email sending
	 * 
	 * @param cc
	 */
	public void setCc(String cc) {
		this.cc = cc;
	}
	/**
	 * gets the cc for the email sending
	 * 
	 * @return cc
	 */
	public String getCc() {
		return cc;
	}
	/**
	 * gets the dialogic fse
	 * 
	 * @return dialogicfse
	 */
	public String getDialogicfse() {
		return dialogicfse;
	}
	/**
	 * sets the dialogic fse
	 * 
	 * @param dialogicfse
	 */
	public void setDialogicfse(String dialogicfse) {
		this.dialogicfse = dialogicfse;
	}
	/**
	 * returns the end user name
	 * 
	 * @return end user name
	 */
	public String getEndUserName() {
		return endUserName;
	}
	/**
	 * sets the end user name
	 * 
	 * @param endUserName
	 */
	public void setEndUserName(String endUserName) {
		this.endUserName = endUserName;
	}
	/**
	 * returns the reason for request
	 * 
	 * @return the reason for the request
	 */
	public String getReasonForRequest() {
		return ReasonForRequest;
	}
	/**
	 * sets a new reason for request
	 * @param reasonForRequest
	 */
	public void setReasonForRequest(String resonForRequest) {
		ReasonForRequest = resonForRequest;
	}
	/**
	 * returns the  expiration date
	 * 
	 * @return expiration date
	 */
	public Date getExpirationDate() {
		return expirationDate;
	}
	/**
	 * sets the new expiration date
	 * 
	 * @param expirationDate
	 */
	public void setExpirationDate(Date expirationDate) {
		this.expirationDate = expirationDate;
	}

	
	/**
	 * 
	 * @return The id of the request given by mazor system
	 */
	public int getId() {
		return id;
	}
	/**
	 * 
	 * @return The  request date of the DPA request
	 */
	public Date getRequestDate() {
		return requestDate;
	}
	/**
	 * sets a new request date
	 * 
	 * @param requestDate 
	 */
	public void setRequestDate(Date requestDate) {
		this.requestDate = requestDate;
	}
	/**
	 * 
	 * @param id - sets a new id for the DPA request
	 */
	public void setId(int id) {
		this.id = id;
	}
	/**
	 * 
	 * @return the additional information of the request
	 */
	public String getAdditionalInformation() {
		return additionalInformation;
	}
	/**
	 * 
	 * sets a the additional information for the request
	 * @param additionalInformation
	 */
	public void setAdditionalInformation(String additionalInformation) {
		this.additionalInformation = additionalInformation;
	}
	/**
	 * returns the target customer for which the request is destined 
	 * 
	 * @return customer
	 */
	public Customer getCustomer() {
		return customer;
	}
	/**
	 * sets a new customer for which the request is destined
	 * 
	 * 
	 * @param customer
	 */
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	/**
	 * sets if the dpa is a draft or not 
	 * 
	 * @param isDraft
	 */
	public void setDraft(boolean draft) {
		this.draft = draft;
	}
	/**
	 * returns the draft state of the dpa
	 * 
	 * @return
	 */
	public boolean isDraft() {
		return draft;
	}
	/**
	 * sets if this dpa is approved by dialoc
	 * 
	 * @param approved
	 */
	public void setApproved(boolean approved) {
		this.approved = approved;
	}
	/**
	 * gets the approval state of the dpa
	 * 
	 * @return
	 */
	public boolean isApproved() {
		return approved;
	}
	/**
	 * sets if the dpa is closed (all the products has qty = qtyPaid)
	 * 
	 * @param closed
	 */
	public void setClosed(boolean closed) {
		this.closed = closed;
	}
	/**
	 * returns whether the dpa is closed  
	 * 
	 * @return
	 */
	public boolean isClosed() {
		return closed;
	}
	/**
	 * 
	 * gets the file name of which the excel report will be saved.
	 * 
	 * @param fileName
	 */
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	/**
	 * returns the file name of which the excel report will be saved.
	 * 
	 * @return fileName
	 */
	public String getFileName() {
		return fileName;
	}
	
	
}

